<!doctype html>


<html>
<head>
  <link rel="shortcut icon" href="static/images/favicon.ico" type="image/x-icon">
  <title>Mock (Closure Library API Documentation - JavaScript)</title>
  <link rel="stylesheet" href="static/css/base.css">
  <link rel="stylesheet" href="static/css/doc.css">
  <link rel="stylesheet" href="static/css/sidetree.css">
  <link rel="stylesheet" href="static/css/prettify.css">

  <script>
     var _staticFilePath = "static/";
     var _typeTreeName = "goog";
     var _fileTreeName = "Source";
  </script>

  <script src="static/js/doc.js">
  </script>

  <script type="text/javascript" src="//www.google.com/jsapi"></script>
  <script type="text/javascript">
     google.load("visualization", "1", {packages:["orgchart"]});
     var _loadingVisualizations = true;
  </script>

  <meta charset="utf8">
</head>

<body onload="grokdoc.onLoad();">

<div id="header">
  <div class="g-section g-tpl-50-50 g-split">
    <div class="g-unit g-first">
      <a id="logo" href="index.html">Closure Library API Documentation</a>
    </div>

    <div class="g-unit">
      <div class="g-c">
        <strong>Go to class or file:</strong>
        <input type="text" id="ac">
      </div>
    </div>
  </div>
</div>





<div class="colmask rightmenu">
<div class="colleft">
    <div class="col1">
      <!-- Column 1 start -->

<div id="title">
        <span class="fn">testing.Mock</span>
        <span>Extends</span>
        <span class="fn-name">
          
        </span>
</div>

<div class="g-section g-tpl-75-25">
  <div class="g-unit g-first" id="description">
    The base class for a mock object.

  </div>


        <div class="g-unit" id="useful-links">
          <div class="title">Useful links</div>
          <ol>
            <li><a href="local_closure_goog_testing_mock.js.source.html"><span class='source-code-link'>Source Code</span></a></li>
            <li><a href="http://code.google.com/p/closure-library/source/browse/local/closure/goog/testing/mock.js">Git</a></li>
          </ol>
        </div>
</div>






<h2 class="g-first">Inheritance</h2>
<div class='gviz-org-chart-container goog-inline-block'>
<table class='gviz-org-chart' style='display:none'>
  <tr><td>goog.testing.Mock</td><td></td></tr>
</table>
</div>
<div class='gviz-org-chart-container goog-inline-block'>
<table class='gviz-org-chart' style='display:none'>
      <tr><td><span class="type"><a href="class_goog_testing_editor_FieldMock.html">goog.testing.editor.FieldMock</a></span></td><td><span class="type"><a href="class_goog_testing_LooseMock.html">goog.testing.LooseMock</a></span></td></tr>
      <tr><td><span class="type"><a href="class_goog_testing_MockRange.html">goog.testing.MockRange</a></span></td><td><span class="type"><a href="class_goog_testing_LooseMock.html">goog.testing.LooseMock</a></span></td></tr>
        <tr><td><span class="type"><a href="class_goog_testing_LooseMock.html">goog.testing.LooseMock</a></span></td><td>goog.testing.Mock</td></tr>
      <tr><td><span class="type"><a href="class_goog_testing_StrictMock.html">goog.testing.StrictMock</a></span></td><td>goog.testing.Mock</td></tr>
  </table>
</div>




  <h2>Constructor</h2>
      <div class="fn-constructor">
    goog.testing.Mock(<span><span class="arg">objectToMock</span>,&nbsp;<span class="arg">opt_mockStaticMethods</span>,&nbsp;<span class="arg">opt_createProxy</span></span>)
  </div>

   <h3>Parameters</h3>






<table class="horiz-rule">
     
   <tr class="even">
     <td>
        <span class="entryName">objectToMock</span>
        : <span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Object">Object</a></span><span>&nbsp;|&nbsp;</span><span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Function">Function</a></span>
        <div class="entryOverview">The object that should be mocked, or
   the constructor of an object to mock.</div>
     </td>
   </tr>
     
   <tr class="odd">
     <td>
        <span class="entryName">opt_mockStaticMethods</span>
        : <span class="type">boolean=</span>
        <div class="entryOverview">An optional argument denoting that
    a mock should be constructed from the static functions of a class.</div>
     </td>
   </tr>
     
   <tr class="even">
     <td>
        <span class="entryName">opt_createProxy</span>
        : <span class="type">boolean=</span>
        <div class="entryOverview">An optional argument denoting that
    a proxy for the target mock should be created.</div>
     </td>
   </tr>
  </table>


<h2>Instance Methods</h2>


  <div class="legend">
        <span class="key publickey"></span><span>Public</span>
        <span class="key protectedkey"></span><span>Protected</span>
        <span class="key privatekey"></span><span>Private</span>
  </div>







<div>
       <div class="desc">
         Defined in
         <span class="fn-name">
            <a href="class_goog_testing_Mock.html">
              goog.testing.Mock
            </a>
         </span>
       </div>






<div class="section">
  <table class="horiz-rule">


     <tr class="even entry public">
       <td class="access"></td>






  <td>
    <a name="goog.testing.Mock.prototype.$anyTimes"></a>


     <div class="arg">
       <img align="left" src="static/images/blank.gif">

        <span class="entryName">$anyTimes<span class="args">()</span>
        </span>
        &#8658; <span>!</span><span class="type"><a href="class_goog_testing_Mock.html">goog.testing.Mock</a></span>
      </div>


     <div class="entryOverview">
       Allows the expectation to be called any number of times.

     </div>


    <! -- Method details -->
    <div class="entryDetails">

   
      <div class="detailsSection">
        <b>Returns:</b>&nbsp;<span>!</span><span class="type"><a href="class_goog_testing_Mock.html">goog.testing.Mock</a></span>&nbsp;
            This mock object.
      </div>
  
    </div>
   
  </td>


  <td class="view-code">
     <a href="local_closure_goog_testing_mock.js.source.html#line465">code &raquo;</a>
  </td>
     </tr>


     <tr class="odd entry public">
       <td class="access"></td>






  <td>
    <a name="goog.testing.Mock.prototype.$argumentsAsString"></a>


     <div class="arg">
       <img align="left" src="static/images/blank.gif">

        <span class="entryName">$argumentsAsString<span class="args">(<span class="arg">args</span>)</span>
        </span>
        &#8658; <span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/String">string</a></span>
      </div>


     <div class="entryOverview">
       Render the provided argument array to a string to help
clients with debugging tests.

     </div>


    <! -- Method details -->
    <div class="entryDetails">

      <div class="detailsSection">
        <b>Arguments: </b>






<table class="horiz-rule">
     
   <tr class="even">
     <td>
        <span class="entryName">args</span>
        : <span>?</span><span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Array">Array</a></span>.&lt;<span class="type">*</span>&gt;
        <div class="entryOverview">The arguments passed to the mock.</div>
     </td>
   </tr>
  </table>
      </div>
   
      <div class="detailsSection">
        <b>Returns:</b>&nbsp;<span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/String">string</a></span>&nbsp;
            Human-readable string.
      </div>
  
    </div>
   
  </td>


  <td class="view-code">
     <a href="local_closure_goog_testing_mock.js.source.html#line581">code &raquo;</a>
  </td>
     </tr>


     <tr class="even entry public">
       <td class="access"></td>






  <td>
    <a name="goog.testing.Mock.prototype.$atLeastOnce"></a>


     <div class="arg">
       <img align="left" src="static/images/blank.gif">

        <span class="entryName">$atLeastOnce<span class="args">()</span>
        </span>
        &#8658; <span>!</span><span class="type"><a href="class_goog_testing_Mock.html">goog.testing.Mock</a></span>
      </div>


     <div class="entryOverview">
       Allows the expectation to be called any number of times, as long as it's
called once.

     </div>


    <! -- Method details -->
    <div class="entryDetails">

   
      <div class="detailsSection">
        <b>Returns:</b>&nbsp;<span>!</span><span class="type"><a href="class_goog_testing_Mock.html">goog.testing.Mock</a></span>&nbsp;
            This mock object.
      </div>
  
    </div>
   
  </td>


  <td class="view-code">
     <a href="local_closure_goog_testing_mock.js.source.html#line455">code &raquo;</a>
  </td>
     </tr>


     <tr class="odd entry public">
       <td class="access"></td>






  <td>
    <a name="goog.testing.Mock.prototype.$atMostOnce"></a>


     <div class="arg">
       <img align="left" src="static/images/blank.gif">

        <span class="entryName">$atMostOnce<span class="args">()</span>
        </span>
        &#8658; <span>!</span><span class="type"><a href="class_goog_testing_Mock.html">goog.testing.Mock</a></span>
      </div>


     <div class="entryOverview">
       Allows the expectation to be called 0 or 1 times.

     </div>


    <! -- Method details -->
    <div class="entryDetails">

   
      <div class="detailsSection">
        <b>Returns:</b>&nbsp;<span>!</span><span class="type"><a href="class_goog_testing_Mock.html">goog.testing.Mock</a></span>&nbsp;
            This mock object.
      </div>
  
    </div>
   
  </td>


  <td class="view-code">
     <a href="local_closure_goog_testing_mock.js.source.html#line443">code &raquo;</a>
  </td>
     </tr>


     <tr class="even entry public">
       <td class="access"></td>






  <td>
    <a name="goog.testing.Mock.prototype.$do"></a>


     <div class="arg">
       <img align="left" src="static/images/blank.gif">

        <span class="entryName">$do<span class="args">(<span class="arg">expectation</span>,&nbsp;<span class="arg">args</span>)</span>
        </span>
        &#8658; <span class="type">*</span>
      </div>


     <div class="entryOverview">
       If this expectation defines a function to be called,
it will be called and its result will be returned.
Otherwise, if the expectation expects to throw, it will throw.
Otherwise, this method will return defined value.

     </div>


    <! -- Method details -->
    <div class="entryDetails">

      <div class="detailsSection">
        <b>Arguments: </b>






<table class="horiz-rule">
     
   <tr class="even">
     <td>
        <span class="entryName">expectation</span>
        : <span class="type"><a href="class_goog_testing_MockExpectation.html">goog.testing.MockExpectation</a></span>
        <div class="entryOverview">The expectation.</div>
     </td>
   </tr>
     
   <tr class="odd">
     <td>
        <span class="entryName">args</span>
        : <span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Array">Array</a></span>
        <div class="entryOverview">The arguments to the method.</div>
     </td>
   </tr>
  </table>
      </div>
   
      <div class="detailsSection">
        <b>Returns:</b>&nbsp;<span class="type">*</span>&nbsp;
            The return value expected by the mock.
      </div>
  
    </div>
   
  </td>


  <td class="view-code">
     <a href="local_closure_goog_testing_mock.js.source.html#line394">code &raquo;</a>
  </td>
     </tr>


     <tr class="odd entry public">
       <td class="access"></td>






  <td>
    <a name="goog.testing.Mock.prototype.$does"></a>


     <div class="arg">
       <img align="left" src="static/images/blank.gif">

        <span class="entryName">$does<span class="args">(<span class="arg">func</span>)</span>
        </span>
        &#8658; <span>!</span><span class="type"><a href="class_goog_testing_Mock.html">goog.testing.Mock</a></span>
      </div>


     <div class="entryOverview">
       Specifies a function to call for currently pending expectation.
Note, that using this method overrides declarations made
using $returns() and $throws() methods.

     </div>


    <! -- Method details -->
    <div class="entryDetails">

      <div class="detailsSection">
        <b>Arguments: </b>






<table class="horiz-rule">
     
   <tr class="even">
     <td>
        <span class="entryName">func</span>
        : <span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Function">Function</a></span>
        <div class="entryOverview">The function to call.</div>
     </td>
   </tr>
  </table>
      </div>
   
      <div class="detailsSection">
        <b>Returns:</b>&nbsp;<span>!</span><span class="type"><a href="class_goog_testing_Mock.html">goog.testing.Mock</a></span>&nbsp;
            This mock object.
      </div>
  
    </div>
   
  </td>


  <td class="view-code">
     <a href="local_closure_goog_testing_mock.js.source.html#line433">code &raquo;</a>
  </td>
     </tr>


     <tr class="even entry private">
       <td class="access"></td>






  <td>
    <a name="goog.testing.Mock.prototype.$initializeFunctions_"></a>


     <div class="arg">
       <img align="left" src="static/images/blank.gif">

        <span class="entryName">$initializeFunctions_<span class="args">(<span class="arg">objectToMock</span>)</span>
        </span>
      </div>


     <div class="entryOverview">
       Initializes the functions on the mock object.

     </div>


    <! -- Method details -->
    <div class="entryDetails">

      <div class="detailsSection">
        <b>Arguments: </b>






<table class="horiz-rule">
     
   <tr class="even">
     <td>
        <span class="entryName">objectToMock</span>
        : <span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Object">Object</a></span>
        <div class="entryOverview">The object being mocked.</div>
     </td>
   </tr>
  </table>
      </div>
   
  
    </div>
   
  </td>


  <td class="view-code">
     <a href="local_closure_goog_testing_mock.js.source.html#line282">code &raquo;</a>
  </td>
     </tr>


     <tr class="odd entry public">
       <td class="access"></td>






  <td>
    <a name="goog.testing.Mock.prototype.$maybeThrow"></a>


     <div class="arg">
       <img align="left" src="static/images/blank.gif">

        <span class="entryName">$maybeThrow<span class="args">(<span class="arg">expectation</span>)</span>
        </span>
      </div>


     <div class="entryOverview">
       If the expectation expects to throw, this method will throw.

     </div>


    <! -- Method details -->
    <div class="entryDetails">

      <div class="detailsSection">
        <b>Arguments: </b>






<table class="horiz-rule">
     
   <tr class="even">
     <td>
        <span class="entryName">expectation</span>
        : <span class="type"><a href="class_goog_testing_MockExpectation.html">goog.testing.MockExpectation</a></span>
        <div class="entryOverview">The expectation.</div>
     </td>
   </tr>
  </table>
      </div>
   
  
    </div>
   
  </td>


  <td class="view-code">
     <a href="local_closure_goog_testing_mock.js.source.html#line378">code &raquo;</a>
  </td>
     </tr>


     <tr class="even entry public">
       <td class="access"></td>






  <td>
    <a name="goog.testing.Mock.prototype.$mockMethod"></a>


     <div class="arg">
       <img align="left" src="static/images/blank.gif">

        <span class="entryName">$mockMethod<span class="args">(<span class="arg">name</span>)</span>
        </span>
        &#8658; <span class="type">*</span>
      </div>


     <div class="entryOverview">
       The function that replaces all methods on the mock object.

     </div>


    <! -- Method details -->
    <div class="entryDetails">

      <div class="detailsSection">
        <b>Arguments: </b>






<table class="horiz-rule">
     
   <tr class="even">
     <td>
        <span class="entryName">name</span>
        : <span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/String">string</a></span>
        <div class="entryOverview">The name of the method being mocked.</div>
     </td>
   </tr>
  </table>
      </div>
   
      <div class="detailsSection">
        <b>Returns:</b>&nbsp;<span class="type">*</span>&nbsp;
            In record mode, returns the mock object. In replay mode, returns
   whatever the creator of the mock set as the return value.
      </div>
  
    </div>
   
  </td>


  <td class="view-code">
     <a href="local_closure_goog_testing_mock.js.source.html#line333">code &raquo;</a>
  </td>
     </tr>


     <tr class="odd entry protected">
       <td class="access"></td>






  <td>
    <a name="goog.testing.Mock.prototype.$recordAndThrow"></a>


     <div class="arg">
       <img align="left" src="static/images/blank.gif">

        <span class="entryName">$recordAndThrow<span class="args">(<span class="arg">ex</span>)</span>
        </span>
      </div>


     <div class="entryOverview">
       Throws an exception and records that an exception was thrown.

     </div>


    <! -- Method details -->
    <div class="entryDetails">

      <div class="detailsSection">
        <b>Arguments: </b>






<table class="horiz-rule">
     
   <tr class="even">
     <td>
        <span class="entryName">ex</span>
        : <span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Object">Object</a></span>
        <div class="entryOverview">Exception.</div>
     </td>
   </tr>
  </table>
      </div>
   
  
    </div>
   
  </td>


  <td class="view-code">
     <a href="local_closure_goog_testing_mock.js.source.html#line523">code &raquo;</a>
  </td>
     </tr>


     <tr class="even entry protected">
       <td class="access"></td>






  <td>
    <a name="goog.testing.Mock.prototype.$recordCall"></a>


     <div class="arg">
       <img align="left" src="static/images/blank.gif">

        <span class="entryName">$recordCall<span class="args">(<span class="arg">name</span>,&nbsp;<span class="arg">args</span>)</span>
        </span>
        &#8658; <span class="type">*</span>
      </div>


     <div class="entryOverview">
       Records an actual method call, intended to be overridden by a
subclass. The subclass must find the pending expectation and return the
correct value.

     </div>


    <! -- Method details -->
    <div class="entryDetails">

      <div class="detailsSection">
        <b>Arguments: </b>






<table class="horiz-rule">
     
   <tr class="even">
     <td>
        <span class="entryName">name</span>
        : <span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/String">string</a></span>
        <div class="entryOverview">The name of the method being called.</div>
     </td>
   </tr>
     
   <tr class="odd">
     <td>
        <span class="entryName">args</span>
        : <span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Array">Array</a></span>
        <div class="entryOverview">The arguments to the method.</div>
     </td>
   </tr>
  </table>
      </div>
   
      <div class="detailsSection">
        <b>Returns:</b>&nbsp;<span class="type">*</span>&nbsp;
            The return expected by the mock.
      </div>
  
    </div>
   
  </td>


  <td class="view-code">
     <a href="local_closure_goog_testing_mock.js.source.html#line369">code &raquo;</a>
  </td>
     </tr>


     <tr class="odd entry protected">
       <td class="access"></td>






  <td>
    <a name="goog.testing.Mock.prototype.$recordExpectation"></a>


     <div class="arg">
       <img align="left" src="static/images/blank.gif">

        <span class="entryName">$recordExpectation<span class="args">()</span>
        </span>
      </div>


     <div class="entryOverview">
       Records the currently pending expectation, intended to be overridden by a
subclass.

     </div>

   
  </td>


  <td class="view-code">
     <a href="local_closure_goog_testing_mock.js.source.html#line357">code &raquo;</a>
  </td>
     </tr>


     <tr class="even entry public">
       <td class="access"></td>






  <td>
    <a name="goog.testing.Mock.prototype.$registerArgumentListVerifier"></a>


     <div class="arg">
       <img align="left" src="static/images/blank.gif">

        <span class="entryName">$registerArgumentListVerifier<span class="args">(<span class="arg">methodName</span>,&nbsp;<span class="arg">fn</span>)</span>
        </span>
        &#8658; <span>!</span><span class="type"><a href="class_goog_testing_Mock.html">goog.testing.Mock</a></span>
      </div>


     <div class="entryOverview">
       Registers a verfifier function to use when verifying method argument lists.

     </div>


    <! -- Method details -->
    <div class="entryDetails">

      <div class="detailsSection">
        <b>Arguments: </b>






<table class="horiz-rule">
     
   <tr class="even">
     <td>
        <span class="entryName">methodName</span>
        : <span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/String">string</a></span>
        <div class="entryOverview">The name of the method for which the verifierFn
    should be used.</div>
     </td>
   </tr>
     
   <tr class="odd">
     <td>
        <span class="entryName">fn</span>
        : <span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Function">Function</a></span>
        <div class="entryOverview">Argument list verifier function.  Should take 2 argument
    arrays as arguments, and return true if they are considered equivalent.</div>
     </td>
   </tr>
  </table>
      </div>
   
      <div class="detailsSection">
        <b>Returns:</b>&nbsp;<span>!</span><span class="type"><a href="class_goog_testing_Mock.html">goog.testing.Mock</a></span>&nbsp;
            This mock object.
      </div>
  
    </div>
   
  </td>


  <td class="view-code">
     <a href="local_closure_goog_testing_mock.js.source.html#line320">code &raquo;</a>
  </td>
     </tr>


     <tr class="odd entry public">
       <td class="access"></td>






  <td>
    <a name="goog.testing.Mock.prototype.$replay"></a>


     <div class="arg">
       <img align="left" src="static/images/blank.gif">

        <span class="entryName">$replay<span class="args">()</span>
        </span>
      </div>


     <div class="entryOverview">
       Switches from recording to replay mode.

     </div>

   
  </td>


  <td class="view-code">
     <a href="local_closure_goog_testing_mock.js.source.html#line488">code &raquo;</a>
  </td>
     </tr>


     <tr class="even entry public">
       <td class="access"></td>






  <td>
    <a name="goog.testing.Mock.prototype.$reset"></a>


     <div class="arg">
       <img align="left" src="static/images/blank.gif">

        <span class="entryName">$reset<span class="args">()</span>
        </span>
      </div>


     <div class="entryOverview">
       Resets the state of this mock object. This clears all pending expectations
without verifying, and puts the mock in recording mode.

     </div>

   
  </td>


  <td class="view-code">
     <a href="local_closure_goog_testing_mock.js.source.html#line498">code &raquo;</a>
  </td>
     </tr>


     <tr class="odd entry public">
       <td class="access"></td>






  <td>
    <a name="goog.testing.Mock.prototype.$returns"></a>


     <div class="arg">
       <img align="left" src="static/images/blank.gif">

        <span class="entryName">$returns<span class="args">(<span class="arg">val</span>)</span>
        </span>
        &#8658; <span>!</span><span class="type"><a href="class_goog_testing_Mock.html">goog.testing.Mock</a></span>
      </div>


     <div class="entryOverview">
       Specifies a return value for the currently pending expectation.

     </div>


    <! -- Method details -->
    <div class="entryDetails">

      <div class="detailsSection">
        <b>Arguments: </b>






<table class="horiz-rule">
     
   <tr class="even">
     <td>
        <span class="entryName">val</span>
        : <span class="type">*</span>
        <div class="entryOverview">The return value.</div>
     </td>
   </tr>
  </table>
      </div>
   
      <div class="detailsSection">
        <b>Returns:</b>&nbsp;<span>!</span><span class="type"><a href="class_goog_testing_Mock.html">goog.testing.Mock</a></span>&nbsp;
            This mock object.
      </div>
  
    </div>
   
  </td>


  <td class="view-code">
     <a href="local_closure_goog_testing_mock.js.source.html#line409">code &raquo;</a>
  </td>
     </tr>


     <tr class="even entry public">
       <td class="access"></td>






  <td>
    <a name="goog.testing.Mock.prototype.$throwCallException"></a>


     <div class="arg">
       <img align="left" src="static/images/blank.gif">

        <span class="entryName">$throwCallException<span class="args">(<span class="arg">name</span>,&nbsp;<span class="arg">args</span>,&nbsp;<span class="arg">opt_expectation</span>)</span>
        </span>
      </div>


     <div class="entryOverview">
       Throw an exception based on an incorrect method call.

     </div>


    <! -- Method details -->
    <div class="entryDetails">

      <div class="detailsSection">
        <b>Arguments: </b>






<table class="horiz-rule">
     
   <tr class="even">
     <td>
        <span class="entryName">name</span>
        : <span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/String">string</a></span>
        <div class="entryOverview">Name of method called.</div>
     </td>
   </tr>
     
   <tr class="odd">
     <td>
        <span class="entryName">args</span>
        : <span>?</span><span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Array">Array</a></span>.&lt;<span class="type">*</span>&gt;
        <div class="entryOverview">Arguments passed to the mock.</div>
     </td>
   </tr>
     
   <tr class="even">
     <td>
        <span class="entryName">opt_expectation</span>
        : <span class="type">goog.testing.MockExpectation=</span>
        <div class="entryOverview">Expected next call,
    if any.</div>
     </td>
   </tr>
  </table>
      </div>
   
  
    </div>
   
  </td>


  <td class="view-code">
     <a href="local_closure_goog_testing_mock.js.source.html#line601">code &raquo;</a>
  </td>
     </tr>


     <tr class="odd entry protected">
       <td class="access"></td>






  <td>
    <a name="goog.testing.Mock.prototype.$throwException"></a>


     <div class="arg">
       <img align="left" src="static/images/blank.gif">

        <span class="entryName">$throwException<span class="args">(<span class="arg">comment</span>,&nbsp;<span class="arg">opt_message</span>)</span>
        </span>
      </div>


     <div class="entryOverview">
       Throws an exception and records that an exception was thrown.

     </div>


    <! -- Method details -->
    <div class="entryDetails">

      <div class="detailsSection">
        <b>Arguments: </b>






<table class="horiz-rule">
     
   <tr class="even">
     <td>
        <span class="entryName">comment</span>
        : <span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/String">string</a></span>
        <div class="entryOverview">A short comment about the exception.</div>
     </td>
   </tr>
     
   <tr class="odd">
     <td>
        <span class="entryName">opt_message</span>
        : <span>?</span><span class="type">string=</span>
        <div class="entryOverview">A longer message about the exception.</div>
     </td>
   </tr>
  </table>
      </div>
   
  
    </div>
   
  </td>


  <td class="view-code">
     <a href="local_closure_goog_testing_mock.js.source.html#line512">code &raquo;</a>
  </td>
     </tr>


     <tr class="even entry public">
       <td class="access"></td>






  <td>
    <a name="goog.testing.Mock.prototype.$throws"></a>


     <div class="arg">
       <img align="left" src="static/images/blank.gif">

        <span class="entryName">$throws<span class="args">(<span class="arg">val</span>)</span>
        </span>
        &#8658; <span>!</span><span class="type"><a href="class_goog_testing_Mock.html">goog.testing.Mock</a></span>
      </div>


     <div class="entryOverview">
       Specifies a value for the currently pending expectation to throw.

     </div>


    <! -- Method details -->
    <div class="entryDetails">

      <div class="detailsSection">
        <b>Arguments: </b>






<table class="horiz-rule">
     
   <tr class="even">
     <td>
        <span class="entryName">val</span>
        : <span class="type">*</span>
        <div class="entryOverview">The value to throw.</div>
     </td>
   </tr>
  </table>
      </div>
   
      <div class="detailsSection">
        <b>Returns:</b>&nbsp;<span>!</span><span class="type"><a href="class_goog_testing_Mock.html">goog.testing.Mock</a></span>&nbsp;
            This mock object.
      </div>
  
    </div>
   
  </td>


  <td class="view-code">
     <a href="local_closure_goog_testing_mock.js.source.html#line420">code &raquo;</a>
  </td>
     </tr>


     <tr class="odd entry public">
       <td class="access"></td>






  <td>
    <a name="goog.testing.Mock.prototype.$times"></a>


     <div class="arg">
       <img align="left" src="static/images/blank.gif">

        <span class="entryName">$times<span class="args">(<span class="arg">times</span>)</span>
        </span>
        &#8658; <span>!</span><span class="type"><a href="class_goog_testing_Mock.html">goog.testing.Mock</a></span>
      </div>


     <div class="entryOverview">
       Specifies the number of times the expectation should be called.

     </div>


    <! -- Method details -->
    <div class="entryDetails">

      <div class="detailsSection">
        <b>Arguments: </b>






<table class="horiz-rule">
     
   <tr class="even">
     <td>
        <span class="entryName">times</span>
        : <span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Number">number</a></span>
        <div class="entryOverview">The number of times this method will be called.</div>
     </td>
   </tr>
  </table>
      </div>
   
      <div class="detailsSection">
        <b>Returns:</b>&nbsp;<span>!</span><span class="type"><a href="class_goog_testing_Mock.html">goog.testing.Mock</a></span>&nbsp;
            This mock object.
      </div>
  
    </div>
   
  </td>


  <td class="view-code">
     <a href="local_closure_goog_testing_mock.js.source.html#line477">code &raquo;</a>
  </td>
     </tr>


     <tr class="even entry public">
       <td class="access"></td>






  <td>
    <a name="goog.testing.Mock.prototype.$verify"></a>


     <div class="arg">
       <img align="left" src="static/images/blank.gif">

        <span class="entryName">$verify<span class="args">()</span>
        </span>
      </div>


     <div class="entryOverview">
       Verify that all of the expectations were met. Should be overridden by
subclasses.

     </div>

   
  </td>


  <td class="view-code">
     <a href="local_closure_goog_testing_mock.js.source.html#line548">code &raquo;</a>
  </td>
     </tr>


     <tr class="odd entry public">
       <td class="access"></td>






  <td>
    <a name="goog.testing.Mock.prototype.$verifyCall"></a>


     <div class="arg">
       <img align="left" src="static/images/blank.gif">

        <span class="entryName">$verifyCall<span class="args">(<span class="arg">expectation</span>,&nbsp;<span class="arg">name</span>,&nbsp;<span class="arg">args</span>)</span>
        </span>
        &#8658; <span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Boolean">boolean</a></span>
      </div>


     <div class="entryOverview">
       Verifies that a method call matches an expectation.

     </div>


    <! -- Method details -->
    <div class="entryDetails">

      <div class="detailsSection">
        <b>Arguments: </b>






<table class="horiz-rule">
     
   <tr class="even">
     <td>
        <span class="entryName">expectation</span>
        : <span class="type"><a href="class_goog_testing_MockExpectation.html">goog.testing.MockExpectation</a></span>
        <div class="entryOverview">The expectation to check.</div>
     </td>
   </tr>
     
   <tr class="odd">
     <td>
        <span class="entryName">name</span>
        : <span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/String">string</a></span>
        <div class="entryOverview">The name of the called method.</div>
     </td>
   </tr>
     
   <tr class="even">
     <td>
        <span class="entryName">args</span>
        : <span>?</span><span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Array">Array</a></span>.&lt;<span class="type">*</span>&gt;
        <div class="entryOverview">The arguments passed to the mock.</div>
     </td>
   </tr>
  </table>
      </div>
   
      <div class="detailsSection">
        <b>Returns:</b>&nbsp;<span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Boolean">boolean</a></span>&nbsp;
            Whether the call matches the expectation.
      </div>
  
    </div>
   
  </td>


  <td class="view-code">
     <a href="local_closure_goog_testing_mock.js.source.html#line562">code &raquo;</a>
  </td>
     </tr>


  </table>
</div>
</div>




<h2>Instance Properties</h2>







<div>
       <div class="desc">
         Defined in
         <span class="fn-name">
            <a href="class_goog_testing_Mock.html">
              goog.testing.Mock
            </a>
         </span>
       </div>






<div class="section">
  <table class="horiz-rule">


     <tr class="even entry private">
       <td class="access"></td>





  <a name="goog.testing.Mock.prototype.$argumentListVerifiers_"></a>

  <td>


     <div class="arg">
        <img align="left" src="static/images/blank.gif">

        <span class="entryName">$argumentListVerifiers_</span>
        : 
     </div>


     <div class="entryOverview">
       Map of argument name to optional argument list verifier function.

     </div>

  </td>


  <td class="view-code">
     <a href="local_closure_goog_testing_mock.js.source.html#line248">Code &raquo;</a>
  </td>
     </tr>


     <tr class="odd entry protected">
       <td class="access"></td>





  <a name="goog.testing.Mock.prototype.$pendingExpectation"></a>

  <td>


     <div class="arg">
        <img align="left" src="static/images/blank.gif">

        <span class="entryName">$pendingExpectation</span>
        : <span class="type"><a href="class_goog_testing_MockExpectation.html">goog.testing.MockExpectation</a></span>
     </div>


     <div class="entryOverview">
       The expectation currently being created. All methods that modify the
current expectation return the Mock object for easy chaining, so this is
where we keep track of the expectation that's currently being modified.

     </div>

  </td>


  <td class="view-code">
     <a href="local_closure_goog_testing_mock.js.source.html#line266">Code &raquo;</a>
  </td>
     </tr>


     <tr class="even entry public">
       <td class="access"></td>





  <a name="goog.testing.Mock.prototype.$proxy"></a>

  <td>


     <div class="arg">
        <img align="left" src="static/images/blank.gif">

        <span class="entryName">$proxy</span>
        : 
     </div>


     <div class="entryOverview">
       A proxy for the mock.  This can be used for dependency injection in lieu of
the mock if the test requires a strict instanceof check.

     </div>

  </td>


  <td class="view-code">
     <a href="local_closure_goog_testing_mock.js.source.html#line241">Code &raquo;</a>
  </td>
     </tr>


     <tr class="odd entry private">
       <td class="access"></td>





  <a name="goog.testing.Mock.prototype.$recording_"></a>

  <td>


     <div class="arg">
        <img align="left" src="static/images/blank.gif">

        <span class="entryName">$recording_</span>
        : 
     </div>


     <div class="entryOverview">
       Whether or not we are in recording mode.

     </div>

  </td>


  <td class="view-code">
     <a href="local_closure_goog_testing_mock.js.source.html#line256">Code &raquo;</a>
  </td>
     </tr>


     <tr class="even entry private">
       <td class="access"></td>





  <a name="goog.testing.Mock.prototype.$threwException_"></a>

  <td>


     <div class="arg">
        <img align="left" src="static/images/blank.gif">

        <span class="entryName">$threwException_</span>
        : 
     </div>


     <div class="entryOverview">
       First exception thrown by this mock; used in $verify.

     </div>

  </td>


  <td class="view-code">
     <a href="local_closure_goog_testing_mock.js.source.html#line274">Code &raquo;</a>
  </td>
     </tr>


  </table>
</div>
</div>










<div class="section">
  <table class="horiz-rule">


  </table>
</div>



<h2>Static Properties</h2>






<div class="section">
  <table class="horiz-rule">


     <tr class="even entry public">
       <td class="access"></td>





  <a name="goog.testing.Mock.LOOSE"></a>

  <td>


     <div class="arg">
        <img align="left" src="static/images/blank.gif">

        <span class="entryNamespace">goog.testing.Mock.</span><span class="entryName">LOOSE</span>
        : 
     </div>


     <div class="entryOverview">
       Option that may be passed when constructing function, method, and
constructor mocks. Indicates that the expected calls should be accepted in
any order.

     </div>

  </td>


  <td class="view-code">
     <a href="local_closure_goog_testing_mock.js.source.html#line204">Code &raquo;</a>
  </td>
     </tr>


     <tr class="odd entry private">
       <td class="access"></td>





  <a name="goog.testing.Mock.PROTOTYPE_FIELDS_"></a>

  <td>


     <div class="arg">
        <img align="left" src="static/images/blank.gif">

        <span class="entryNamespace">goog.testing.Mock.</span><span class="entryName">PROTOTYPE_FIELDS_</span>
        : 
     </div>


     <div class="entryOverview">
       This array contains the name of the functions that are part of the base
Object prototype.
Basically a copy of goog.object.PROTOTYPE_FIELDS_.

     </div>

  </td>


  <td class="view-code">
     <a href="local_closure_goog_testing_mock.js.source.html#line225">Code &raquo;</a>
  </td>
     </tr>


     <tr class="even entry public">
       <td class="access"></td>





  <a name="goog.testing.Mock.STRICT"></a>

  <td>


     <div class="arg">
        <img align="left" src="static/images/blank.gif">

        <span class="entryNamespace">goog.testing.Mock.</span><span class="entryName">STRICT</span>
        : 
     </div>


     <div class="entryOverview">
       Option that may be passed when constructing function, method, and
constructor mocks. Indicates that the expected calls should be accepted in
the recorded order only.

     </div>

  </td>


  <td class="view-code">
     <a href="local_closure_goog_testing_mock.js.source.html#line214">Code &raquo;</a>
  </td>
     </tr>


  </table>
</div>









<div class="section">
  <table class="horiz-rule">


  </table>
</div>
      <!-- Column 1 end -->
    </div>

        <div class="col2">
          <!-- Column 2 start -->
          <div class="col2-c">
            <h2 id="ref-head">Package testing</h2>
            <div id="localView"></div>
          </div>

          <div class="col2-c">
            <h2 id="ref-head">Package Reference</h2>
            <div id="sideTypeIndex" rootPath="" current="testing.Mock"></div>
          </div>
          <!-- Column 2 end -->
        </div>
</div>
</div>

</body>
</html>
